﻿<!--
 Peter
 Created by: Peter Development Team
    http://peter.codeplex.com/
 
 GNU General Public License version 2 (GPLv2)
    http://peter.codeplex.com/license
-->
<Popup x:Class="Peter.Common.AutoComplete.AutoCompletePopup"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
       mc:Ignorable="d"
       d:DesignHeight="300"
       d:DesignWidth="300">
   <Grid>
      <Grid.Resources>
         <Style TargetType="{x:Type ListBoxItem}">

            <Setter Property="Template">
               <Setter.Value>
                  <ControlTemplate TargetType="{x:Type ListBoxItem}">
                     <Border x:Name="Border"
                             BorderBrush="{TemplateBinding BorderBrush}"
                             BorderThickness="{TemplateBinding BorderThickness}"
                             Background="{TemplateBinding Background}"
                             Padding="{TemplateBinding Padding}"
                             SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Margin="0 1 0 2" />
                     </Border>
                     <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected"
                                 Value="true">
                           <Setter Property="Background"
                                   TargetName="Border"
                                   Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                           <Setter Property="Foreground"
                                   Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                        </Trigger>
                     </ControlTemplate.Triggers>
                  </ControlTemplate>
               </Setter.Value>
            </Setter>
         </Style>
      </Grid.Resources>
      <ListBox Focusable="False"
               ItemsSource="{Binding Path=ListItems}"
               SelectedIndex="{Binding Path=SelectedIndex}"
               SelectedItem="{Binding Path=SelectedListItem}"
               PreviewMouseMove="OnPopupMouseMove"
               PreviewMouseLeftButtonUp="OnPopupMouseLeftButtonUp"
               PreviewMouseLeftButtonDown="OnPopupMouseLeftButtonDown" />
   </Grid>
</Popup>
